package org.example.B_100;

import java.util.Scanner;
import java.util.StringJoiner;

/**
 * 按单词下标区间翻转文章内容
 */
public class FlipArticleContentByWordSubscriptInterval {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();
        int startIndex = Integer.parseInt(sc.nextLine());
        int endIndex = Integer.parseInt(sc.nextLine());

        System.out.println(getResult(s,startIndex,endIndex));
    }

    public static String getResult(String s,int startIndex,int endIndex){
        String[] sArr = s.split(" ");

        //规范输入反转的索引值
        startIndex = Math.min(Math.max(0,startIndex),sArr.length - 1);
        endIndex = Math.min(Math.max(0,endIndex),sArr.length - 1);

        if(startIndex >= endIndex){
            return s;
        }

        int l = startIndex;
        int r = endIndex;

        while (l < r){
            String tmp = sArr[l];
            sArr[l] = sArr[r];
            sArr[r] = tmp;
            l++;
            r--;
        }

        StringJoiner sj = new StringJoiner(" ");
        for(String t : sArr){
            sj.add(t);
        }
        return sj.toString();

    }
}
